package com.ysd.lis.controller;


import com.ysd.common.Result;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.WkTrainingPlan;
import com.ysd.lis.service.WkTrainingPlanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 培训计划表 前端控制器
 * </p>
 *
 * @author LiuQi
 * @since 2024-03-20
 */
@RestController
@RequestMapping("/wk/training/plan")
public class WkTrainingPlanController extends BaseController {

    @Autowired
    WkTrainingPlanService WkTrainingPlanService;

    @GetMapping("/getTrainingPlanList")
    public Result getTrainingPlanList(@RequestParam(required = false, value = "keyWord") String keyWord, @RequestParam(required = false, value = "status") Integer status) {
        return WkTrainingPlanService.getTrainingPlanList(keyWord, status);
    }

    @GetMapping("/getTrainingInfo/{id}/{userId}")
    public Result getTrainingInfo(@PathVariable(value = "id", required = false) String id, @PathVariable(value = "userId", required = false) String userId) {
        return WkTrainingPlanService.getTrainingInfo(id, userId);
    }

    @GetMapping("/getTrainingListByUserId/{userId}")
    public Result getTrainingListByUserId(@PathVariable(value = "userId") String userId) {
        return WkTrainingPlanService.getTrainingListByUserId(userId);
    }

    @GetMapping("/getTrainingListByKnowledgeId/{knowledgeId}")
    public Result getTrainingListByKnowledgeId(@PathVariable(value = "knowledgeId") String knowledgeId) {
        return WkTrainingPlanService.getTrainingListByKnowledgeId(knowledgeId);
    }

    @PostMapping("/addTrainingPlan")
    public Result addTrainingPlan(@RequestBody WkTrainingPlan wkTrainingPlan) {
        return WkTrainingPlanService.addTrainingPlan(wkTrainingPlan);
    }

    @PostMapping("/updateTrainingPlan")
    public Result updateTrainingPlan(@RequestBody WkTrainingPlan wkTrainingPlan) {
        return WkTrainingPlanService.updateTrainingPlan(wkTrainingPlan);
    }

    @PostMapping("/deleteTrainingPlanByIds")
    public Result deleteTrainingPlanByIds(@RequestBody List<String> ids) {
        return WkTrainingPlanService.deleteTrainingPlanByIds(ids);
    }

}
